<?php
require_once __DIR__.'/vendor/autoload.php';
require_once 'config.php';

use Qiniu\Auth;

header('Access-Control-Allow-Origin:*');
$bucket = Config::BUCKET_ADVERTISE;
$auth = new Auth(Config::AK, Config::SK);

//$key = $_POST['key'];
  //notify url
/* $wmImg = Qiniu\base64_urlSafeEncode('http://7xljtw.com1.z0.glb.clouddn.com/FhueWV01rg8u90dqhf5gGgjAa2zq');
$pfopOps = "avthumb/m3u8/segtime/10/wmImage/$wmImg";
$policy = array(
    'persistentOps' => $pfopOps,
    'persistentNotifyUrl' => 'http://172.30.251.210:8080/cb.php',
		'persistentPipeline' => 'soharos1'
); 

$upToken = $auth->uploadToken($bucket, $key, 3600, $policy); */ 

$upToken = $auth->uploadToken($bucket);

echo json_encode(array('uptoken' => $upToken));
